<!--
 * @Author: dfh
 * @Date: 2024-03-25 16:42:44
 * @LastEditors: dfh
 * @Modified By: dfh
 * @describe: 
-->
<template>
    <view class="flex">
        <text class="iconfont  ml-10 txt-16" :class="computedRate(0.5, 1)"></text>
        <text class="iconfont  ml-10 txt-16" :class="computedRate(1.5, 2)"></text>
        <text class="iconfont  ml-10 txt-16" :class="computedRate(2.5, 3)"></text>
        <text class="iconfont  ml-10 txt-16" :class="computedRate(3.5, 4)"></text>
        <text class="iconfont  ml-10 txt-16" :class="computedRate(4.5, 5)"></text>
    </view>
</template>

<script setup>

const props = defineProps({
    rate: {
        type: String,
        default: ''
    }
})


const computedRate = (v1, v2) => {
    let icon = 'icon-star'
    if (parseFloat(props.rate) >= v2) {
        icon = 'icon-star-copy'
    }
    if (parseFloat(props.rate) == v1) {
        icon = 'icon-cc-star-half'
    }

    return icon;
}
</script>
<style>
.icon-cc-star-half,.icon-star-copy,.icon-star{
    font-size: 22rpx;
}
</style>
<style lang="scss" scoped></style>